package com.cjl.dental_clinic.controller;

import com.cjl.dental_clinic.Req.OrderReq;
import com.cjl.dental_clinic.base.BaseController;
import com.cjl.dental_clinic.base.ResVo;
import com.cjl.dental_clinic.entity.Order;
import com.cjl.dental_clinic.service.OrderService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @description:
 * @author: cjl
 * @time: 2024/04/13 21:24
 */
@RestController
@RequestMapping("cjl/order")
public class OrderController extends BaseController<Order, OrderService> {
    public OrderController(OrderService baseService) {
        super(baseService);
    }

    @PostMapping("list")
    public ResVo<List<OrderReq>> list(String name) {
        return ResVo.ok(baseService.listOrder(name));
    }
    @PostMapping("pay")
    public ResVo<String> pay(Integer id){
        if (baseService.pay(id)) {
            return ResVo.ok("支付成功");
        }
        return ResVo.error("支付失败");
    }
}
